<script type="text/javascript"> 
	jQuery(document).ready(function(){ 
		jQuery( "#accordion_evolucion" ).accordion({
			autoHeight: false,
			navigation: true
		});

		jQuery( "#evolucionResizer" ).resizable({
			minHeight: 120,
			resize: function() {
				jQuery( "#accordion_evolucion" ).accordion( "resize" );
			}
		});
	});	

	function ActivarEvolucion(){
		jQuery( "#evolucionResizer" ).show("slide", {}, 1000);
	}
</script>
<div id="foto_perfil">
<?php
	if($person['Person']['sex_id'] == 1){ // Si es Masculino
		$imagen_paciente = "/images/profile_m.png";
	}else{
		$imagen_paciente = "/images/profile_w.png";
	}
?>
	<a href="javascript:MostrarModal('ventana_modal','Datos del Paciente','/people/edit/<?php echo $person['Person']['id']?>',500,630)"><img src="<?php echo $imagen_paciente?>" width="40" alt="Ver Ficha del Paciente" title="Ver Ficha del Paciente"></a>
</div>
<div id="nombre_perfil">
	<div style="float: right; margin-top: 10px;">
		<!-- <a href="javascript:ActivarEvolucion()" class="link_destacado"><?php echo __("Evolucionar Paciente") ?></a> -->
		<a href="javascript:MostrarModal('ventana_modal','Evolución Rápida','/evolutions/rapida/<?php echo $person['Person']['id']?>',500,280)" class="link_destacado"><?php echo __("Evolucionar Paciente") ?></a>
	</div>
	<h2><?php echo $person['Person']['full_name'] ?></h2>
	<a href="javascript:MostrarModal('ventana_modal','Datos del Paciente','/people/edit/<?php echo $person['Person']['id']?>',500,600)">Modificar</a>
</div>
<div id="detalle_perfil">
	<?php echo $person['Sex']['name']; ?>&nbsp;|&nbsp;<?php echo date('d/m/Y', strtotime($person['Person']['fecha_nacimiento'])). "  ($edad años)"; ?>&nbsp;|&nbsp;<?php echo $person['Typodocument']['name']; ?>&nbsp;<?php echo $person['Person']['nro_documento']; ?>&nbsp;|&nbsp;<?php echo $person['Gruposanguineo']['name']; ?>&nbsp;|&nbsp;<?php echo $person['Person']['email']; ?>&nbsp;|&nbsp;<?php echo $person['Person']['telefono']; ?>
</div>
<div id="tags_perfil">
<?php
	if(!empty($tags_paciente)){
		foreach($tags_paciente as $tag){
			echo '<span class="etiquetas_tags">'.$tag['Problem']['name'].'&nbsp;</span><img src="/images/ico-pinche-rojo.gif" style="margin: 0px 0px 0px -3px;">&nbsp;';
		}
	}
?>
</div>
<script type="text/javascript">
<?php 
	$remoteFunction2 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'people_problems', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'problemas_paciente', 'indicator' => 'cargando' 
	    ) 
	);

	$remoteFunction3 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'evolutions', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'evoluciones_paciente', 'indicator' => 'cargando' 
	    ) 
	);

	$remoteFunction4 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'people_signs', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'signos_paciente', 'indicator' => 'cargando' 
	    ) 
	);

	$remoteFunction6 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'results', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'resultados_paciente', 'indicator' => 'cargando' 
	    ) 
	);

	$remoteFunction7 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'people_vademecums', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'vademecum_paciente', 'indicator' => 'cargando' 
	    ) 
	);

	$remoteFunction8 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'registros', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'historia_paciente', 'indicator' => 'cargando' 
	    ) 
	);

	$remoteFunction9 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'people_practices', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'prescripciones_paciente', 'indicator' => 'cargando' 
	    ) 
	);

	$remoteFunction99 = $ajax->remoteFunction( 
	    array( 
		'url' => array( 'controller' => 'turns', 'action' => 'index', $person['Person']['id'] ),
		'update' => 'turnos_paciente', 'indicator' => 'cargando' 
	    ) 
	);


	// Activo una Pestaña
	$activar_tab = "tab".$tab_activa;


	switch($tab_activa){
		case 2:
			echo $remoteFunction2.";";
			break;
		case 3:
			echo $remoteFunction3.";";
			break;
		case 4:
			echo $remoteFunction4.";";
			break;
		case 6:
			echo $remoteFunction6.";";
			break;
		case 7:
			echo $remoteFunction7.";";
			break;
		case 8:
			echo $remoteFunction8.";";
			break;
		case 9:
			echo $remoteFunction9.";";
			break;
		case 99:
			echo $remoteFunction99.";";
			break;
		default:
			echo $remoteFunction3.";";
			break;
	}


	// Cargo todos los contenidos de las Pestañas
//	echo $remoteFunction2.";";
//	echo $remoteFunction3.";";
//	echo $remoteFunction4.";";
//	echo $remoteFunction6.";";
//	echo $remoteFunction7.";";
//	echo $remoteFunction8.";";
//	echo $remoteFunction9.";";
//	echo $remoteFunction99.";";

?>
	jQuery(document).ready(function($){ 
		jQuery("ul.tabs li").removeClass("active");
		jQuery(".tab_content").hide();


 		jQuery("ul.tabs li:has(a[rel=<?php echo $activar_tab ?>])").addClass("active").show(); //Activate tab
		jQuery("#<?php echo $activar_tab ?>").show(); //Show tab content


		jQuery("ul.tabs li").click(function()
	       {
			jQuery("ul.tabs li").removeClass("active");
			jQuery(this).addClass("active");
			jQuery(".tab_content").hide();
 
			var activeTab = jQuery(this).find("a").attr("href");
			jQuery(activeTab).fadeIn();
			return false;
		});
	});
</script>
<ul class="tabs">
    <li><a href="#tab3" rel="tab3" onclick="<?php echo $remoteFunction3 ?>">Evoluciones</a></li>
    <li><a href="#tab2" rel="tab2" onclick="<?php echo $remoteFunction2 ?>">Problemas</a></li>
    <li><a href="#tab9" rel="tab9" onclick="<?php echo $remoteFunction9 ?>"><img src="/images/ico-prescripciones.gif" vspace="3" border="0" alt="Prescripciones" title="Prescripciones"/></a></li>
    <li><a href="#tab4" rel="tab4" onclick="<?php echo $remoteFunction4 ?>"><img src="/images/ico-signos.gif" vspace="3" border="0" alt="Signo Vitales" title="Signo Vitales"/></a></li>
    <li><a href="#tab6" rel="tab6" onclick="<?php echo $remoteFunction6 ?>"><img src="/images/ico-resultados.gif" vspace="3" border="0" alt="Resultados" title="Resultados"/></a></li>
    <li><a href="#tab7" rel="tab7" onclick="<?php echo $remoteFunction7 ?>"><img src="/images/ico-pildora.png" vspace="2" border="0" alt="Medicaciones" title="Medicaciones"/></a></li>
    <li><a href="#tab99" rel="tab99" onclick="<?php echo $remoteFunction99 ?>"><img src="/images/ico-turnos.gif" vspace="3" border="0" alt="Turnos" title="Turnos"/></a></li>
    <li><a href="#tab8" rel="tab8" onclick="<?php echo $remoteFunction8 ?>"><img src="/images/ico-grafico.gif" vspace="3" border="0" alt="Historia del Paciente" title="Historia del Paciente"/></a></li>
</ul>
<div class="tab_container">
    <div id="tab2" class="tab_content"><div id="problemas_paciente"><img src="/images/loading3.gif"></div></div>
    <div id="tab3" class="tab_content"><div id="evoluciones_paciente"><img src="/images/loading3.gif"></div></div>
    <div id="tab9" class="tab_content">
		<div id="contain_subtabs">
			<div id="prescripciones_paciente"><img src="/images/loading3.gif"></div>
		</div>
	</div>
    <div id="tab4" class="tab_content"><div id="signos_paciente"><img src="/images/loading3.gif"></div></div>
    <div id="tab6" class="tab_content"><div id="resultados_paciente"><img src="/images/loading3.gif"></div></div>
    <div id="tab7" class="tab_content"><div id="vademecum_paciente"><img src="/images/loading3.gif"></div></div>
    <div id="tab99" class="tab_content"><div id="turnos_paciente"><img src="/images/loading3.gif"></div></div>
    <div id="tab8" class="tab_content"><div id="historia_paciente"><img src="/images/loading3.gif"></div></div>
</div>